<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <html>
 <head>
 <title>vxBug</title>
 <link rel="shortcut icon" type="image/x-icon" href="./resources/favicon.ico" />
     <!-- Latest compiled and minified CSS -->
     <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
     <link rel="stylesheet" href="quarcum.dyndns.org:8087/resources/css/main.css">
 </head>
<body>
<div class="container">

 <%@ include file="header_login.jsp" %>
    <div class="jumbotron">

     <h3>Welcome to vxBug! <small>selfmade bug tracker</small></h3>
 </div>

<security:authorize ifAllGranted="ROLE_ADMIN">
    <button type="button" class="btn btn-default" navbar-btn onclick="location.href='./userManager'">User Manager</button>
    <button type="button" class="btn btn-default" navbar-btn onclick="location.href='./addProgram'">Add program</button>
    <br /><br />
</security:authorize>

 <div class="list-group">
<c:forEach items="${programs}" var="program">
     <a href="/vxBug/program/${program.id}" class="list-group-item">
         <h4 class="list-group-item-heading">${program.id}. ${program.name}
             <c:forEach items="${users}" var="u">
                 <c:if test="${u.id == program.creatorUserId}">
                      (by <c:out value="${u.name}" />)
                 </c:if>
             </c:forEach>
         </h4>
         <p class="list-group-item-text">${program.description}</p>
     </a>
</c:forEach>
 </div>

    </div> <!-- /container -->
</body>
</html>
